<template>
	<view class="me">
		<view class="m1">
			<view class="m2">
				<u-avatar src="../../static/hmlogo.png" size="70"></u-avatar>
			</view>
			<view class="m4">
				<view class="m3">
					<text>昵称：{{message.userName}}</text>
				</view>
				<view class="m3">
					<text>性别：{{message.sex}}</text>
				</view>
				<view class="m3">
					<text>用户ID：{{message.idCard}}</text>
				</view>
			</view>
		</view>
		<view class="g1">
			<view class="g2" @click="tomessage">
				<view class="g3">
					<u-icon name="account-fill" size="20" style="margin-right: 10px;"></u-icon>
					<text>个人信息</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<u-line></u-line>
			<view class="g2">
				<view class="g3">
					<u-icon name="bookmark-fill" size="20" style="margin-right: 10px;"></u-icon>
					<text>订单列表</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<u-line></u-line>
			<view class="g2" @click="topassword">
				<view class="g3">
					<u-icon name="edit-pen-fill" size="20" style="margin-right: 10px;"></u-icon>
					<text>修改密码</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<u-line></u-line>
			<view class="g2" @click="tooptions">
				<view class="g3">
					<u-icon name="chat-fill" size="20" style="margin-right: 10px;"></u-icon>
					<text>意见反馈</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<u-line></u-line>
			<view class="g2" @click="logout">
				<view class="g3">
					<u-icon name="minus-circle-fill" size="20" style="margin-right: 10px;"></u-icon>
					<text>退出登录</text>
				</view>
				<u-icon name="arrow-right"></u-icon>
			</view>
			<u-line></u-line>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				message:{}
			}
		},
		onLoad() {
			this.getmessage()
		},
		methods: {
			getmessage(){
				this.api.get('/prod-api/api/common/user/getInfo').then(res=>{
					this.message=res.data.user
				})
			},
			tomessage(){
				uni.navigateTo({
					url:'/pages/me/privateMessage/privateMessage'
				})
			},
			topassword(){
				uni.navigateTo({
					url:'/pages/me/password/password'
				})
			},
			tooptions(){
				uni.navigateTo({
					url:'/pages/me/options/options'
				})
			},
			logout(){
				uni.removeStorageSync('token_j')
				uni.removeStorageSync('login')
				setTimeout(function(){
					uni.showToast({
						title:'退出成功'
					})
				},600)
				uni.reLaunch({
					url:'/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="scss">
.m1{
	width: 300px;
	height: 120px;
	margin: 20px auto;
	border: 3px solid mediumpurple;
	border-radius: 15px;
	display: flex;
	.m2{
		padding-top: 25px;
		padding-left: 20px;
	}
	.m3{
		font-weight: 550;
	}
	.m4{
		margin-left: 20px;
		line-height: 30px;
	}
}
.g2{
	justify-content: space-between;
	display: flex;
	font-size: 20px;
	margin-top: 15px;
	margin-bottom: 15px;
}
.g3{
	display: flex;
}
</style>
